﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Elderos.Ontology;

namespace Elderos.Highlight.Rules
{
    public class RuleSynonymSuffix : SynonymRule
    {
        private readonly string _suffix;

        public RuleSynonymSuffix(IOntologyData ontology, string suffix) : base(ontology)
        {
            _suffix = suffix;
        }

        public override IRuleResult EmptyResult
        {
            get { return new BinomialResult(Name, false);}
        }

        protected override IRuleResult ComputeResult(string synonym)
        {
            bool result = synonym.EndsWith(_suffix, true, CultureInfo.InvariantCulture);
            return new BinomialResult(Name, result);
        }
    }
}
